import Vue from 'vue'
import App from './App.vue'
import router from './router'
import Axios from 'axios';
import qs from 'qs';
import $ from 'jquery';
import './plugins/iview.js'
window.Axios = Axios;
window.Qs = qs;
window.$ = $;
Vue.prototype.$map = window.AMap;

Vue.config.productionTip = false
document.documentElement.style.height = document.documentElement.clientHeight+'px';

import Common from './common/common.js';
router.beforeEach((to,from,next)=>{
  Common.isLogin(sysinfo.activity_id,(res)=>{
    if(to.name != 'index' && !res){
      next({replace:true,name:'index'});
      return;
    }
    if(to.name == 'index' && res){
      next({replace:true,name:from.name ? from.name: 'home'});
      return;
    }
  });
  next();
});


new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
